# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=python-engineio
pkgver=4.4.0
pkgrel=2
pkgdesc='Python implementation of the Engine.IO realtime server'
url='https://github.com/miguelgrinberg/python-engineio'
arch=('any')
license=('MIT')
depends=('python' 'python-six' 'python-urllib3' 'python-websocket-client' 'python-websockets' 'python-requests')
optdepends=('python-eventlet: eventlet driver'
            'python-aiohttp: aiohttp driver'
            'python-tornado: tornado driver'
            'python-gevent: gevent driver'
            'python-gevent-websocket: gevent driver')
makedepends=('python-setuptools' 'python-sphinx' 'python-six' 'python-eventlet' 'python-aiohttp' 'python-tornado'
             'python-urllib3' 'python-websocket-client' 'python-gevent' 'python-gevent-websocket' 'python-websockets'
             'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest' 'python-pytest-runner')
options=('!makeflags')
source=(https://github.com/miguelgrinberg/python-engineio/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('b7995aaf2583ec58ac87f048608653ade3846dd103616ee90b3dc12cc7e27c7d37959cd3e1ebf6e138395ff6fad8cd011407b6660258715e513bf72c8a3e1f6f')
b2sums=('4cf40802fddcce2e53e205bdbe73bdf0ec822e15581fe4a9939b8d05c3eb6ba82a99d089d4708169b197aa79e5b5f14001ff86f72025fc6d96c99ed6d73fe620')

build() {
  cd ${pkgname}-${pkgver}
  python -m build --wheel --no-isolation
  make -C docs man text SPHINXBUILD=sphinx-build
}

check() {
  cd ${pkgname}-${pkgver}
  PYTHONPATH=build/lib python setup.py test
}

package() {
  cd ${pkgname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/text/*.txt -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/man/python-engineio.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"
}

# vim: ts=2 sw=2 et:
